﻿using Sustainalytics.Entities;
using System;
using System.Collections.Generic;

namespace Sustainalytics.DataLayer
{
    /// <summary>
    /// News repository.
    /// </summary>
    public interface INewsRepository
    {
        /// <summary>
        /// Get filtered news.
        /// </summary>
        /// <param name="filter"> News filter. </param>
        /// <param name="skip"> Skip number of items. </param>
        /// <param name="take"> Take number of items. </param>
        /// <param name="orderBy"> Order criteria. </param>
        /// <returns> Filtered news. </returns>
        List<News> GetNews(NewsFilter filter, int? skip = null, int? take = null, string[] orderBy = null, bool orderByAsc = true);

        /// <summary>
        /// Get filtered news count.
        /// </summary>
        /// <param name="filter"> News filter. </param>
        /// <returns> Number of news. </returns>
        int GetNewsCount(NewsFilter filter);

        /// <summary>
        /// Get news by ID.
        /// </summary>
        /// <param name="newsId"> News ID. </param>
        /// <returns> News. </returns>
        News GetNews(Guid newsId);

        /// <summary>
        /// Get news by IDs.
        /// </summary>
        /// <param name="newsIds"> News IDs. </param>
        /// <returns> Filtered news. </returns>
        IEnumerable<News> GetNewsByIds(IEnumerable<Guid> newsIds);

        /// <summary>
        /// Add news.
        /// </summary>
        /// <param name="news"> News data. </param>
        /// <returns> Added news. </returns>
        void AddNews(News news);

        /// <summary>
        /// Update news.
        /// </summary>
        /// <param name="news"> News data. </param>
        /// <returns> Updated news. </returns>
        void UpdateNews(News news);

        /// <summary>
        /// Delete news.
        /// </summary>
        /// <param name="newsId"> News ID to delete. </param>
        void DeleteNews(Guid newsId);

        /// <summary>
        /// Delete multiple news.
        /// </summary>
        /// <param name="newsItems"> News items to delete. </param>
        void DeleteMultipleNews(IEnumerable<Guid> newsItems);

        List<Guid> ReadUnpublishedWithStatusActive(DateTime date);

        bool UpdateNewsToUnpublished(List<Tuple<Guid, NewsStatus>> list);
    }
}
